package com.eltsistemas.os.dao.veiculo;

import org.hibernate.Query;
import org.hibernate.Session;

import com.eltsistemas.os.modelo.veiculo.Cilindrada;

public class BuscaPorId {

	private Session session;
	
	public BuscaPorId(Session session)
	{
		this.session=session;
	}
	
	public Long getId(String attr, String nomeClasse)
	{
		
		Query query = this.session.createQuery("SELECT id from "+nomeClasse+" "+
				"where nome = :attr");
				query.setString("attr", attr);
			
	    Long id = (Long) query.uniqueResult();
		
		return id;
	}

}
